Function.prototype.ddBind = function (thisArg, ...args1) {
  var fn = this
  thisArg = (thisArg !== null && thisArg !== undefined) ? Object(thisArg) : window
  return function (...args2) {
    thisArg.fn = fn
    //对两个传入的参数进行合并
    var finalArgs = [...args1, ...args2]
    var res = thisArg.fn(finalArgs)
    delete thisArg.fn
    return res
  }
  
}

function foo() {
  console.log('foo被执行', this)
  
}

function sum(num1, num2, num3) {
  console.log(num1, num2, num3)
}

var bar = foo.ddBind('abc')
bar()

